#!/bin/bash

declare -i tries=5

while [[ $tries>0 ]]; do
  ssh -o ConnectTimeout=10 $*
  rc=$?
  if [[ $rc != 255 ]]; then exit $rc ; fi
  echo "$tries tries remaining"
  tries+=-1
done
